/**
 * 数据保存，页面卸载前触发
 */
import { onUnmounted, onMounted } from "vue";
export const useBeforeUnload = () => {
  const handleMessage = (e: any) => {
    e.preventDefault();
  };

  onMounted(() => {
    window.addEventListener("beforeunload", handleMessage);
  });

  onUnmounted(() => {
    window.removeEventListener("beforeunload", handleMessage);
  });
};
